package com.aoxin.controller.activity;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.aoxin.model.activity.SlfRecommendedThreshold;
import com.aoxin.service.inter.activity.SlfRecommendedThresholdService;
import com.aoxin.util.AjaxRes;
import com.aoxin.util.Const;
import com.aoxin.util.enumerate.OperateType;
import com.aoxin.util.log.LogInfo;
/**
 * 阈值数据controller
 * @author lop
 * @date 2018年5月22日 下午6:11:22
 */
@RestController
@RequestMapping("/web/slfRecommendedThreshold/")
public class SlfRecommendedThresholdController {
	@Autowired
	SlfRecommendedThresholdService slfrecommendedthresholdservice;
	
	/**
	 * 获取阈值数据 正序
	 * @param res
	 * @param slfrecommendedthreshold
	 * @return
	 */
	@RequestMapping("getRecommendedThresholdData")
	@LogInfo(operateType = OperateType.QUERY, content = "查询推荐阈值数据")
	public AjaxRes getRecommendedThresholdData(AjaxRes res,SlfRecommendedThreshold slfrecommendedthreshold){
		try {
			List<SlfRecommendedThreshold> slfrecommendedthresholdList=this.slfrecommendedthresholdservice.getRecommendedThresholdData(slfrecommendedthreshold);  
			res.setSucceed(slfrecommendedthresholdList, Const.DATA_SUCCEED);
		} catch (Exception e) {
			res.setFailMsg(e.getMessage());
		}
		return res;
	}
	
	/**
	 * 添加阈值数据
	 * @param res
	 * @param slfrecommendedthreshold
	 * @return
	 */
	@RequestMapping("insertRecommendedThresholdData")
	@LogInfo(operateType = OperateType.QUERY, content = "添加推荐阈值数据")
	public AjaxRes insertRecommendedThresholdData(AjaxRes res,SlfRecommendedThreshold slfrecommendedthreshold){
		try {
			this.slfrecommendedthresholdservice.insertRecommendedThresholdData(slfrecommendedthreshold);  
			res.setSucceed(Const.SAVE_SUCCEED);
		} catch (Exception e) {
			res.setFailMsg(e.getMessage());
		}
		return res;
	}
	
	
	/**
	 * 修改阈值数据 
	 * @param res
	 * @param slfrecommendedthreshold
	 * @return
	 */
	@RequestMapping("updateRecommendedThresholdData")
	@LogInfo(operateType = OperateType.QUERY, content = "修改推荐金额数据")
	public AjaxRes updateRecommendedThresholdData(AjaxRes res,SlfRecommendedThreshold slfrecommendedthreshold){
		try {
			this.slfrecommendedthresholdservice.updateRecommendedThresholdData(slfrecommendedthreshold);  
			res.setSucceed(Const.UPDATE_SUCCEED);
		} catch (Exception e) {
			res.setFailMsg(e.getMessage());
		}
		return res;
	}
	

	/**
	 * 删除阈值数据 
	 * @param res
	 * @param slfrecommendedthreshold
	 * @return
	 */
	@RequestMapping("deleteRecommendedThresholdData")
	@LogInfo(operateType = OperateType.QUERY, content = "删除推荐金额数据")
	public AjaxRes deleteRecommendedThresholdData(AjaxRes res, @RequestParam("recommendedThresholdId") List<Integer> recommendedThresholdId){
		try {
			this.slfrecommendedthresholdservice.deleteRecommendedThresholdData(recommendedThresholdId);  
			res.setSucceed(Const.DEL_SUCCEED);
		} catch (Exception e) {
			res.setFailMsg(e.getMessage());
		}
		return res;
	}

}
